package com.ruoyi.laiqianba.service.impl;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.db.domain.MerchantCheckInfo;
import com.ruoyi.laiqianba.http.AdminHttpUtil;
import com.ruoyi.laiqianba.service.IAdminHttpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class AdminHttpService implements IAdminHttpService {

    @Autowired
    AdminHttpUtil adminHttpUtil;

    @Override
    public AjaxResult enterAccount(String recordId, String operatorId, String operatorName){
        String uri = "/api/admin/account/enterAccount";

        Map<String, Object> bizMap = new HashMap<>();
        bizMap.put("recordId", recordId);
        bizMap.put("operatorId", operatorId);
        bizMap.put("operatorName", operatorName);

        return adminHttpUtil.httpRequest(uri, bizMap);
    }

    @Override
    public AjaxResult merchantDataPushManual(String infoId, String uid) {
        String uri = "/api/admin/merchant/pushManual";

        Map<String, Object> bizMap = new HashMap<>();
        bizMap.put("infoId", infoId);
        bizMap.put("uid", uid);

        return adminHttpUtil.httpRequest(uri, bizMap);
    }

    @Override
    public AjaxResult toSayHello(String loginUid, String msgContent) {
        String uri = "/api/admin/im/toSayHello";

        Map<String, Object> bizMap = new HashMap<>();
        Long userId = SecurityUtils.getUserId();
        bizMap.put("loginUid",userId);
        bizMap.put("toUserId",loginUid);
        bizMap.put("msgContent",msgContent);
        return adminHttpUtil.httpRequest(uri, bizMap);
    }

    @Override
    public AjaxResult merchantcheckPush(MerchantCheckInfo merchantCheckInfo) {
        String uri = "api/merchant/testCheck";
        Map<String, Object> bizMap = new HashMap<>();
        bizMap.put("infoId",merchantCheckInfo.getInfoId());
        bizMap.put("infoName",merchantCheckInfo.getInfoName());
        bizMap.put("mobile",merchantCheckInfo.getMobile());
        bizMap.put("realName",merchantCheckInfo.getRealName());
        bizMap.put("idCard",merchantCheckInfo.getIdCard());
        bizMap.put("city",merchantCheckInfo.getCity());
        //bizMap.put("remarks",merchantCheckInfo.getRemarks());
        return adminHttpUtil.httpRequest(uri, bizMap);
    }

    @Override
    public AjaxResult sendSms() {
        String uri = "api/sms/sendSmsMarketing";
        Map<String, Object> bizMap = new HashMap<>();
        return adminHttpUtil.httpRequest(uri, bizMap);
    }

    @Override
    public AjaxResult merchantCheckAndPushTask() {
        String uri = "api/product/push/merchant/apis";
        Map<String, Object> bizMap = new HashMap<>();
        return adminHttpUtil.httpRequest(uri, bizMap);
    }

    @Override
    public AjaxResult pushMembersTask() {
        String uri = "api/member/pushMember";
        Map<String, Object> bizMap = new HashMap<>();
        return adminHttpUtil.httpRequest(uri, bizMap);
    }


}
